set(LOCAL_MODULE bluetoothtbd)

# Common variables
# ========================================================
set(btserviceCommonSrc
	adapter.cpp 
	adapter_state.cpp 
	advertise_data.cpp 
	advertise_settings.cpp 
	daemon.cpp 
	gatt_server.cpp 
	hal/bluetooth_gatt_interface.cpp 
	hal/bluetooth_interface.cpp 
	ipc/ipc_handler.cpp 
	ipc/ipc_handler_unix.cpp 
	ipc/ipc_manager.cpp 
	ipc/unix_ipc_host.cpp 
	logging_helpers.cpp 
	low_energy_client.cpp 
	settings.cpp 
	util/atomic_string.cpp 
	uuid.cpp
)

set(btserviceBinderSrc
	ipc/binder/bluetooth_binder_server.cpp 
	ipc/binder/bluetooth_low_energy_binder_server.cpp 
	ipc/binder/IBluetooth.cpp 
	ipc/binder/IBluetoothCallback.cpp 
	ipc/binder/IBluetoothLowEnergy.cpp 
	ipc/binder/IBluetoothLowEnergyCallback.cpp 
	ipc/binder/ipc_handler_binder.cpp 
	ipc/binder/parcel_helpers.cpp
)

include_directories($(CMAKE_CURRENT_SOURCE_DIR)/.. $(CMAKE_CURRENT_SOURCE_DIR)/include)

# Native system service for target
# ========================================================
set(LOCAL_SRC_FILES
	${btserviceCommonSrc} 
	main.cpp
)
add_definitions("-std=c++11")
add_executable(${LOCAL_MODULE} ${LOCAL_SRC_FILES})
target_link_libraries(${LOCAL_MODULE} ${CMAKE_THREAD_LIBS_INIT} bluetooth.default
	libbt-hci
	libbt-vendor
	libbt-utils
	libbtcore
)

# Native system service CLI for target
# ========================================================
#LOCAL_SRC_FILES := \
#	$(btserviceBinderSrc) \
#	adapter_state.cpp \
#	advertise_data.cpp \
#	advertise_settings.cpp \
#	client/main.cpp
#LOCAL_C_INCLUDES += $(btserviceCommonIncludes)
#LOCAL_CFLAGS += -std=c++11
#LOCAL_MODULE_TAGS := optional
#LOCAL_MODULE := bluetooth-cli
#LOCAL_SHARED_LIBRARIES += \
#	libbinder \
#	libchrome \
#	libutils
#include $(BUILD_EXECUTABLE)
